package org.dna.uimodel;

import java.util.List;

import org.dna.metronomo.persistence.Job;
import org.dna.metronomo.persistence.User;

/**
 * Decorator for User to permit the selection status.
 * */
public final class SelectableUser extends User {

	private static final long serialVersionUID = 8433048381308604441L;
	private User m_orig;
	private boolean selected = false;
	
	public SelectableUser(User orig) {
		super();
		m_orig = orig;
	}
	
	public boolean isSelected() {
		return selected;
	}

	void setSelected(boolean selected) {
		this.selected = selected;
	}
	
    @Override
	public int getId() {
		return m_orig.getId();
	}

    @Override
	public List<Job> getJobs() {
		return m_orig.getJobs();
	}

    @Override
	public String getName() {
		return m_orig.getName();
	}

    @Override
	public String getPassword() {
		return m_orig.getPassword();
	}

    @Override
	public void setPassword(String pwd) {
		m_orig.setPassword(pwd);
	}

    @Override
	public void setRole(String role) {
		m_orig.setRole(role);
	}

    @Override
	public String getRole() {
		return m_orig.getRole();
	}
	
	@Override
	public String toString() {
        return String.format("sel=%b %s", selected, m_orig);
	}
}
